﻿using System;
using Wizard.Source;

namespace Wizard.Runtime
{
    using Wizard;

    public class ThreadStep //: Data.CacheableObject
    {
    //    private int mPc;
    //    private ThreadStep mPreviousThreadStep;
    //    private ThreadStep mParentThreadStep;
    //    private IBlockInstance mBlockInstance;
    //    private bool mWaitForUser;
    //    private ThreadStep mNextThreadStep;
    //    private RunningState mState;
    //    internal Thread mThread;
    //    private Statements.Statement mStatement;

    //    internal int Pc
    //    {
    //        get { return mPc; }
    //    }


    //    internal ThreadStep PreviousThreadStep
    //    {
    //        get { return mPreviousThreadStep; }
    //    }


    //    internal ThreadStep ParentThreadStep
    //    {
    //        get { return mParentThreadStep; }
    //    }


    //    internal IBlockSource BlockSource
    //    {
    //        get {
    //            return mBlockInstance.BlockSource; 
    //        }
    //    }

    //    internal IBlockInstance BlockInstance
    //    {
    //        get { return mBlockInstance; }
    //    } 



    //    public bool WaitForUser
    //    {
    //        get { return mWaitForUser; }
    //    } 

    //    public ThreadStep()
    //    { // for testing
    //    }

    //    internal ThreadStep(
    //        Thread thread,
    //        ThreadStep previousThreadStep,
    //        ThreadStep parentThreadStep,
    //        IBlockInstance blockInstance,
    //        int pc, 
    //        RunningState state)
    //    {
    //        mThread = thread;
    //        mState = state;
    //        this.mPreviousThreadStep = previousThreadStep;
    //        this.mPc = pc;
    //        bool waitForUser = false;
    //        this.mWaitForUser = waitForUser;
    //        this.mBlockInstance = blockInstance;
    //        this.mParentThreadStep = parentThreadStep;
    //        if (mPreviousThreadStep != null)
    //        {
    //            mPreviousThreadStep.mNextThreadStep = this;
    //        }
    //    }

    //    internal Statements.Statement GetStatement()
    //    {
    //        //if (mStatement == null)
    //        //{
    //        //    IStatementSource line = mBlockInstance.BlockSource.GetStatement(mPc);
    //        //    if (line == null) return null;
    //        //    var runContext = new IRunContext(this);
    //        //    mStatement = line.Instantiate(runContext);
    //        //}
    //        //return mStatement;
    //        return null;
    //    }

    //    internal ThreadStep NextThreadStep
    //    {
    //        get { return mNextThreadStep; }
    //    }

    //    internal RunningState RunningState
    //    {
    //        get { return mState; }
    //    }

    //    public bool IsRunning()
    //    {
    //        return mThread.IsRunning();
    //    }

    //    public void StepForward(object applicationContext)
    //    {
    //        if (mThread.Current != this) mThread.MoveTo(this, applicationContext);
    //        mThread.StepForward(applicationContext);
    //    }

    }

}